package com.woniu.p2p.serviceImpl;

import com.woniu.p2p.entity.AdminRecord;
import com.woniu.p2p.entity.OperationRecord;
import com.woniu.p2p.entity.UserRecord;
import com.woniu.p2p.mapper.AdminRecordMapper;
import com.woniu.p2p.mapper.OperationRecordMapper;
import com.woniu.p2p.mapper.UserRecordMapper;
import com.woniu.p2p.service.SystemRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class SystemRecordServiceImpl implements SystemRecordService {

    @Autowired
    private AdminRecordMapper adminRecordMapper;
    @Autowired
    private OperationRecordMapper operationRecordMapper;

    @Autowired
    private UserRecordMapper userRecordMapper;

    @Override
    public int addAdminRecord(AdminRecord adminRecord) {
        return adminRecordMapper.insert(adminRecord);
    }

    @Override
    public int addOperationRecord(OperationRecord operationRecord) {
        return operationRecordMapper.insert(operationRecord);
    }

    @Override
    public List<AdminRecord> searchAdminRecord(Map<String, Object> map) {
        return adminRecordMapper.selectAllByMap(map);
    }

    @Override
    public List<OperationRecord> searchOperationRecord(Map<String, Object> map) {
        return operationRecordMapper.selectAllByMap(map);
    }

    @Override
    public int addUserRecord(UserRecord userRecord) {
        return userRecordMapper.insert(userRecord);
    }

    @Override
    public List<UserRecord> searchUserRecord(Map<String, Object> map) {
        return userRecordMapper.selectAllByMap(map);
    }
}
